package com.y5neko.RadiantKnightExploit.exp.Shiro;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.*;


public class Shiro550 {
    public static HBox getHBox() {
        HBox hBox = new HBox();
        hBox.setPadding(new Insets(10, 10, 10, 10));

        GridPane gridPane = new GridPane();
        gridPane.setHgap(3);
//        gridPane.setVgap(10);
        HBox.setHgrow(gridPane, Priority.ALWAYS);

        ColumnConstraints column1 = new ColumnConstraints(Region.USE_COMPUTED_SIZE, 30, Double.MAX_VALUE);
        column1.setHgrow(Priority.ALWAYS); column1.setPercentWidth(60);
        ColumnConstraints column2 = new ColumnConstraints(Region.USE_COMPUTED_SIZE, 30, Double.MAX_VALUE);
        column2.setPercentWidth(28); column2.setHgrow(Priority.ALWAYS);
        ColumnConstraints column3 = new ColumnConstraints(Region.USE_COMPUTED_SIZE, 30, Double.MAX_VALUE);
        column3.setPercentWidth(12); column3.setHgrow(Priority.ALWAYS);
        gridPane.getColumnConstraints().addAll(column1, column2, column3);
        


        HBox targetInfo = new HBox(5);
        targetInfo.setAlignment(Pos.CENTER_LEFT);

        ObservableList<String> methods = FXCollections.observableArrayList("GET ", "POST");
        ComboBox<String> method = new ComboBox<>(methods);
        method.getSelectionModel().selectFirst();
        HBox.setHgrow(method, Priority.ALWAYS);

        Label urlLabel = new Label("URL:");
        TextField url = new TextField("http://127.0.0.1:8080");
        HBox.setHgrow(url, Priority.ALWAYS);
        targetInfo.getChildren().addAll(method, urlLabel, url);
        gridPane.add(targetInfo, 0, 0);


        HBox rememberMeInfo = new HBox();
        rememberMeInfo.setAlignment(Pos.CENTER_LEFT);
        Label rememberMeLabel = new Label("RememberMe字段名:");
        TextField rememberMeFlag = new TextField("rememberMe");
        rememberMeInfo.getChildren().addAll(rememberMeLabel, rememberMeFlag);
        gridPane.add(rememberMeInfo, 1, 0);

        HBox cipherInfo = new HBox();
        cipherInfo.setAlignment(Pos.CENTER);
        ObservableList<String> cipherTypes = FXCollections.observableArrayList("AES-CBC", "AES-GCM");
        ComboBox<String> cipherType = new ComboBox<>(cipherTypes);
        cipherType.getSelectionModel().selectFirst();
        HBox.setHgrow(cipherType, Priority.ALWAYS);
        cipherInfo.getChildren().add(cipherType);
        gridPane.add(cipherInfo, 2, 0);




        hBox.getStylesheets().add("css/TextField.css");
//        hBox.getStylesheets().add("css/bootstrap3.css");
        hBox.getChildren().add(gridPane);
        return hBox;
    }
}
